/**
 * 后台爬取图片
 */
$(function(){
    var NowPage=$("#NowPage").text();
    /**
     * 爬取请求
     */
    $("#reptileStart").click(function(){
        var urlName=$("#urlName").val();
        var ImageTag=$("#ImageTag").val();
        var ImageNameTag=$("#ImageNameTag").val();
        $.post(
            "/Resources/Images/addImage",
            {
                "urlName":urlName,
                "ImageTag":ImageTag,
                "ImageNameTag":ImageNameTag
            },
            function(result){
                alert(result);
                window.location.reload();
        });
    });
    /**
     * 上一页请求
     */
    $("#PreviousPage").click(function () {
        $(location).attr('href', '/Resources/Images/imagesManage/'+(parseInt(NowPage)-1));
    });
    /**
     * 下一页请求
     */
    $("#NextPage").click(function(){
        $(location).attr('href', '/Resources/Images/imagesManage/'+(parseInt(NowPage)+1));
    });
    /**
     * 删除图片请求
     */
    $(".resourceList").find("a").click(function(){
        var imageId=$(this).attr("alt");
        $.post("/Resources/Images/deleteImage",{"Id":imageId},function(){
            window.location.reload();
        });
    });
});